package edu.uoc.tds.pac4.beans;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * Beans creat per al Informe d'events al que assisteix un Participant 
 *
 */
public class EstEventsAssistent implements Serializable {
	private static final long serialVersionUID = 1L;
	private String universitat;
	private String centre;
	private String event;
	private String tipusEvent;
	private Date dataInici;
	private Date dataFi;
	private boolean actiu;
	private boolean assistit;
	
	public EstEventsAssistent(String universitat, String centre, String event,
			String tipusEvent, Date dataInici, Date dataFi, boolean actiu,
			boolean assistit) {
		super();
		this.universitat = universitat;
		this.centre = centre;
		this.event = event;
		this.tipusEvent = tipusEvent;
		this.dataInici = dataInici;
		this.dataFi = dataFi;
		this.actiu = actiu;
		this.assistit = assistit;
	}

	public String getUniversitat() {
		return universitat;
	}

	public void setUniversitat(String universitat) {
		this.universitat = universitat;
	}

	public String getCentre() {
		return centre;
	}

	public void setCentre(String centre) {
		this.centre = centre;
	}

	public String getEvent() {
		return event;
	}

	public void setEvent(String event) {
		this.event = event;
	}

	public String getTipusEvent() {
		return tipusEvent;
	}

	public void setTipusEvent(String tipusEvent) {
		this.tipusEvent = tipusEvent;
	}

	public Date getDataInici() {
		return dataInici;
	}

	public void setDataInici(Date dataInici) {
		this.dataInici = dataInici;
	}

	public Date getDataFi() {
		return dataFi;
	}

	public void setDataFi(Date dataFi) {
		this.dataFi = dataFi;
	}

	public boolean isActiu() {
		return actiu;
	}

	public void setActiu(boolean actiu) {
		this.actiu = actiu;
	}

	public boolean isAssistit() {
		return assistit;
	}

	public void setAssistit(boolean assistit) {
		this.assistit = assistit;
	}

	public EstEventsAssistent() {
		super();
		// TODO Auto-generated constructor stub
	}
	/**
	 * Construeix a partir d'un RS
	 * @param rs
	 * @throws SQLException 
	 */
	public void buildFromRS(ResultSet rs) throws SQLException {
		// Event
		this.setCentre(rs.getString("c_nom"));
		this.setDataInici(rs.getDate("e_inici"));
		this.setDataFi(rs.getDate("e_fi"));
		this.setEvent(rs.getString("e_descripcio"));
		this.setAssistit((rs.getBoolean("assitencia")));
		this.setActiu((rs.getString("e_actiu")=="S"));
		this.setTipusEvent(rs.getString("t_nom"));
		this.setUniversitat(rs.getString("u_nom"));
	}
		
	
}
